﻿<%@ WebHandler Language="C#" Class="Color_Add" %>

using System;
using System.Web;
using Newtonsoft.Json;

public class Color_Add : IHttpHandler, System.Web.SessionState.IReadOnlySessionState 
{
    
    public void ProcessRequest (HttpContext context) {
        OTS.Common.PageSuccess page = new OTS.Common.PageSuccess();
        if (!OTS.BaseLogin.validataModule(context, (int)OTS.enumSysRight.ColorManager))
        {
            page.success = false;
            page.msg = "非法操作！";

        }
        else
        {
            OTS.BLL.ColorBLL bll = new OTS.BLL.ColorBLL();
            string _col_color = context.Request["color.col_color"];
            string _col_colorGroup = context.Request["color.col_colorGroup"];
            bool bRet = false;


            if (null != _col_color && !"".Equals(_col_color))
            {
                OTS.Model.color model = new OTS.Model.color();
                model.col_color = _col_color;
                model.col_colorGroup = _col_colorGroup;
                bRet = bll.Add(model);
                
            }
            if (bRet)
            {
                page.success = true;
                page.msg = "添加成功！";    
            }
            else
            {
                page.success = false;
                page.msg = "参数有误！";

            }

        }
        context.Response.ContentType = "application/x-json";
        context.Response.Charset = "utf-8";
        context.Response.Write(JavaScriptConvert.SerializeObject(page));
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}